import requestUtil from "@/utils/requestUtil";
import { ContractDesignPageVO, ContractDesignPageQuery } from "@/api/flow/contractDesign.api";
import { PurchasePageVO } from "@/api/fee/purchase.api";
import { ReimbursePageVO } from "@/api/fee/reimburse.api";
import { ContractPageVO } from "@/api/flow/contract.api";

const DASHBOARD_BASE_URL = "/business/home";

const DashboardAPI = {
  /** 加载合同设计 */
  loadContractDesign(queryParams?: ContractDesignPageQuery) {
    return requestUtil.get<PageResult<ContractDesignPageVO[]>>(
      `${DASHBOARD_BASE_URL}/loadContractDesign`,
      queryParams
    );
  },

  /** 加载合同施工 */
  loadContractTask(queryParams?: ContractDesignPageQuery) {
    return requestUtil.get<PageResult<ContractTaskVO[]>>(
      `${DASHBOARD_BASE_URL}/loadContractTask`,
      queryParams
    );
  },

  /** 加载申购 */
  loadPurchase(queryParams?: PageQuery) {
    return requestUtil.get<PageResult<PurchasePageVO[]>>(`${DASHBOARD_BASE_URL}/loadPurchase`, queryParams);
  },

   /** 加载申购 */
  loadReimburse(queryParams?: PageQuery) {
    return requestUtil.get<PageResult<ReimbursePageVO[]>>(`${DASHBOARD_BASE_URL}/loadReimburse`, queryParams);
  },
  loadMyContracts() {
    return requestUtil.get<PageResult<ContractPageVO[]>>(`${DASHBOARD_BASE_URL}/loadMyContracts`);
  },
};

export interface ContractTaskVO{

  contractId?: string;
  contractName?: string;
  taskId?: string;
  taskName?: string;
  status?: string;
  nodeName?: string;
}

export interface FeePageVO {
  /** 费用ID */
  id?: string;
  flowId?: string;
  title?: string;
  remark?: string;
  amount?: number;
  createTime?: string;
  userId?: string;
  username?: string;
  status?: string;
}

export default DashboardAPI;
